<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>用户列表</title>
    <script type="text/javascript" th:src="@{/js/jquery.js}"></script> 
    <script type="text/javascript" th:src="@{/js/jquery-1.7.1.js}"></script> 
    <script type="text/javascript" th:src="@{/js/main.js}"></script>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
</head>
<body>
	<div>
		<h3>操作表单</h3>
		<form id="userForm" method="get">
			<input type="hidden" name="id" id="input_id" />
			<table>
		    	<tr>
			    	<td>用户名</td>
			    	<td>
			    		<input type="text" value="" name ="name" id="input_name"/>
			    		<select name="sex" id="input_sex">
			    			<option value="男">男</option>
			    			<option value="女">女</option>
			    		</select>
			    	</td>
			    </tr>
			    <tr>
			    	<td>年龄</td>
			    	<td><input name="age" id="input_age"/></td>
			    </tr>
			    <tr>
			    	<td>地址</td>
			    	<td><input name="address" id="input_address"/></td>
			    </tr>
		    </table>
		    <input type="button" onClick="saveUser()" value="保存" />
		    <input type="reset" value="清空" />
		</form>
	</div>
	<br />
	
	<div>
		<div>
			<p>删除时数据源节点选择</p>
			<form id="selectSource">
				主节点<input type="radio" name="source" value="master" /> 
				从节点<input type="radio" name="source" value="slave" /> 
			</form>
		</div>
		<br />
		<h3>列表</h3>
		<table>
	    	<tr>
	    		<th>用户名</th>
	    		<th>性别</th>
	    		<th>年龄</th>
	    		<th>地址</th>
	    		<th>修改</th>
	    		<th>
	    			删除
	    		</th>
	    	</tr>
	    	<tr th:each="user : ${userList}">
		    	<td th:text="${user.name}">用户名</td>
		    	<td th:text="${user.sex}">性别</td>
		    	<td th:text="${user.age}">年龄</td>
		    	<td th:text="${user.address}">地址</td>
		    	<td><button type="button" onclick="updateUser(this)" th:value="${user.id}" th:attr="name=${user.name},sex=${user.sex},age=${user.age},address=${user.address}">修改</button></td>
		    	<td><button type="button" onclick="deleteUser(this)" th:value="${user.id}" name="id" >删除</button></td>
		    </tr>
	    </table>
	</div>
</body>
</html>